export const setKeys = (oldData, newData) => {
  for (let k in oldData) {
    //判断是否是数组
    if (oldData[k] instanceof Array) {
      newData[k] = []
      setKeys(oldData[k], newData[k])
    }
    //判断是否是对象
    else if (oldData[k] instanceof Object) {
      newData[k] = {}
      setKeys(oldData[k], newData[k])
    } else {
      if (k === 'label') {
        newData.text = oldData[k]
      } else {
        newData[k] = oldData[k]
      }
    }
  }
}

export const getValue = (list, value) => {
  let id 
  list.forEach(item => {
    if (item.text === value) {
      id = item.value
    }
  })
  return id
}
